//
//  TicketDetailModel.m
//  ImGuider
//
//  Created by 王鹏宇 on 2018/1/24.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "TicketDetailModel.h"

@implementation TicketDetailModel

+ (NSDictionary *)modelCustomPropertyMapper {
    
    return @{@"tid" : @"id",@"ticketTypes":@"subs",@"viewsArray":@"views"};
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    
    return @{@"ticketTypes" : [TicketTypeModel class],@"viewsArray" : [Scenic class]};
}

- (NSString *)dayslimit {
    if (!(_dayslimit.integerValue > 0)) {
        return @"120";
    }
    return _dayslimit;
}

- (NSArray *)pictureArray {
    
    return [self.pictures componentsSeparatedByString:@","];
}

- (NSString *)price {
    
    if (_price.length > 0) {
        
         return  [NSString stringWithFormat:@"%.2f",_price.floatValue / 100];
    }
    return @"0";
}


- (NSString *)priceStr {
    
    NSString *price = @"";
    if ([[AppManager sharedManager].currencyCode isEqualToString:@"USD"]) {
        
        price = [NSString stringWithFormat:@"$%@",self.price];
    } else if ([[AppManager sharedManager].currencyCode isEqualToString:@"CNY"]) {
        
        price = [NSString stringWithFormat:@"¥%@",self.price];
    }
    
    if (price.length == 0) {
        price = [NSString stringWithFormat:@"¥%@",self.price];
    }
    return price;
}

@end
